1. Field of the Invention
The present invention relates to a memory card having a built-in non-volatile semiconductor memory device, and in particular, to a method of controlling the semiconductor memory device.
2. Description of the Related Art
A non-volatile semiconductor memory device such as a NAND flash memory using EEPROM is used as a host apparatus for a digital camera and mobile phone. For example, data stored in the memory card is destroyed resulting from causes such as unexpected removal of the memory card, droppage of the host apparatus and power turn-off.
The following technique has been developed (e.g., see JPN. PAT. APPLN. KOKAI Publication No. 11-306091). According to the technique, a sector having data destroyed by power turn-off is repaired to prevent an actual storage capacity of a memory space of the card from being reduced by the data destroy.
In addition, the following technique has been developed (e.g., see JPN. PAT. APPLN. KOKAI Publication No. 11-306800). According to the technique, a cyclic code is generated from data stored in data storage, and the generated cyclic code is compared with a cyclic code stored in the corresponding block to make a normality test of the block. By doing so, data written in a flash memory is prevented from being destroyed in error.
Recently, a multi-valued NAND flash memory capable of storing several data in one memory cell has been developed. In the multi-valued NAND flash memory, the same column of several pages commonly uses one memory cell. For example, in a four-value NAND flash memory, the same column of two pages commonly uses one memory cell.
The foregoing multi-valued NAND flash memory has the following problems. More specifically, when write is made to one of pages commonly using the memory cell, a write error occurs. Moreover, if write is interrupted resulting for some reason, there is a possibility that the content of another previously written page is destroyed.
For example, a memory card having the NAND flash memory is applied to a digital camera. In this case, when a photograph is taken using the digital camera, photograph data is normally written in the flash memory. Thereafter, when a photograph is taken again, write to the flash memory fails resulting from reasons such as unexpected removal of the memory card, droppage of the camera body and power turn-off during data write. In such a case, the write data is not normally recorded. In addition, there is a possibility that the photograph data of an already written page is destroyed resulting from page management performance of the multi-valued NAND flash memory. Therefore, it is desired to provide a method of controlling a semiconductor memory device, which is capable of preventing a destroy of already written data when writing new data.